package com.fzb.forum4j.po;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Transient;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
@Entity
public class Comment {

	@Id
	@GeneratedValue
	private Integer commentId;
	private Date commTime;
	@Column(length=2000)
	private String content;
	private String userIp;

	@ManyToOne
	@JoinColumn(name="userId")
	private User user;
	@ManyToOne
	@JoinColumn(name="cid")
	private CommonArea area;
	@Transient
	private String forward;

 

	@ManyToOne
	@JoinColumn(name="replyCommId")
	private Comment replyComm;
	
	@OneToMany(targetEntity = Comment.class, cascade = { CascadeType.ALL }, mappedBy = "replyComm")  
	@Fetch(FetchMode.JOIN)  
	@OrderBy("commentId")  
	private Set<Comment> childComm=new HashSet<Comment>();
	private Boolean hide;
	public Integer getCommentId() {
		return commentId;
	}
	public void setCommentId(Integer commentId) {
		this.commentId = commentId;
	}
	public Date getCommTime() {
		return commTime;
	}
	public void setCommTime(Date commTime) {
		this.commTime = commTime;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getUserIp() {
		return userIp;
	}
	public void setUserIp(String userIp) {
		this.userIp = userIp;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
 
 
	public Set<Comment> getChildComm() {
		return childComm;
	}
	public void setChildComm(Set<Comment> childComm) {
		this.childComm = childComm;
	}
	public Boolean getHide() {
		return hide;
	}
	public void setHide(Boolean hide) {
		this.hide = hide;
	}
	
	public CommonArea getArea() {
		return area;
	}
	public void setArea(CommonArea area) {
		this.area = area;
	}
	 
	public Comment getReplyComm() {
		return replyComm;
	}
	public void setReplyComm(Comment replyComm) {
		this.replyComm = replyComm;
	}
	public void setForward(String forward) {
		this.forward = forward;
	}
	public String getForward() {
		return forward;
	}
 


}
